package be.jprojects.tests.filter;

import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JTextField;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

public class FilterField extends JTextField implements DocumentListener {
	private FilteredJList list;

	public FilterField(FilteredJList list, int width) {
		super(width);
		this.list = list;
		getDocument().addDocumentListener(this);
	}

	public void changedUpdate(DocumentEvent e) {
		((FilterModel) list.getModel()).refilter();
	}

	public void insertUpdate(DocumentEvent e) {
		((FilterModel) list.getModel()).refilter();
	}

	public void removeUpdate(DocumentEvent e) {
		((FilterModel) list.getModel()).refilter();
	}

}
